import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: false),
      home: Scaffold(
        appBar: AppBar(title: Text("MyApp")),
        body: MyHomePage(),
      ),
    );
  }
}

//使用SliverGridDelegateWithFixedCrossAxisCount
class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});
  //获取设备的宽度和高度
  // final size =MediaQuery.of(context).size;
  //（了解）算法：（Alignment.x*childwidth/2+childwidth/2，Alignment.y*childHeight
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 300,
      height: 300,
      color: Colors.red,
      child: const Align(
        alignment: Alignment(-0.5, -0.5),
        child: Text("你好Flutter"),
      ),
    );
  }
}
